Create Virtual Machine #2
2010/07/19 |
Create a Virtual Machine from template. |
|
[1] | Create a Virtual Machine from template that is made in Create Virtual Machine #1. |
# copy disk image and XML file for a new Virtual Machine root@ubuntu:~# cp guest.img /var/kvm/images/mail.img root@ubuntu:~# cp guest.xml /etc/libvirt/qemu/mail.xml root@ubuntu:~# uuidgen -t # generate UUID 44bc51c4-93ec-11df-99ae-0022683d8288 # remember root@ubuntu:~# vi /etc/libvirt/qemu/mail.xml <domain type='kvm'> # change name <name> mail </name># change UUID generated above <uuid> 44bc51c4-93ec-11df-99ae-0022683d8288 </uuid><memory>1048576</memory> <currentMemory>1048576</currentMemory> <vcpu>2</vcpu> <os> <type arch='x86_64' machine='pc-0.12'>hvm</type> <boot dev='hd'/> </os> <features> <acpi/> <apic/> <pae/> </features> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/bin/kvm</emulator> <disk type='file' device='disk'> <driver name='qemu' type='raw'/> # change disk <source file='/var/kvm/images/ mail.img '/><target dev='vda' bus='virtio'/> </disk> <interface type='bridge'> # remove the line for mac address <mac address='52:54:00:bc:8f:f3'/> <source bridge='br0'/> <model type='virtio'/> <console type='pty'> <target port='0'/> </console> <console type='pty'> <target port='0'/> </console> </devices> </domain> root@ubuntu:~# virsh define /etc/libvirt/qemu/mail.xml # define new settings Domain mail defined from /etc/libvirt/qemu/mail.xml root@ubuntu:~# virsh start mail --console Domain mail started Connected to domain mail Ubuntu 10.04 LTS www ttyS0 www login: # complete to boot root@www:~# vi /etc/hostname # change hostname you like mail root@www:~# logout Ubuntu 10.04 LTS mail ttyS0 mail login: # complete |